PowerTCP FTP for .NET
Delete(List<ListEntry>) Method
Example 



A file Listing that includes files and directories to delete.
Delete the specified files and directories using a single method.
Syntax
Public Overloads Function Delete( _
   ByVal listing As List(Of ListEntry) _
) As List(Of Response)
Dim instance As Ftp
Dim listing As List(Of ListEntry)
Dim value As List(Of Response)
 
value = instance.Delete(listing)
public List<Response> Delete( 
   List<ListEntry> listing
)
public:
List<Response^>^ Delete( 
   List<ListEntry^>^ listing
) 

Parameters

listing
A file Listing that includes files and directories to delete.

Return Value

A List of Response objects.
Exceptions
ExceptionDescription
FtpProtocolExceptionAt least one command did not succeed. Details are included in the exception thrown.
Remarks

Any specified directories that are not empty (after the specified files are removed) will not be deleted by the server.

Use DeleteDirectory for deleting a directory tree.

First all files, then all directories are removed, starting at the end of the list.

Example
This example demonstrates using the FTP control to delete files and subdirectories.
private void deleteFiles()
{
    //Delete a list of files (in this case, the txt files).
    ftp1.Delete(ftp1.ListDirectoryTree("MyTextFiles", "*.txt", false));

    //Delete a specific file.
    ftp1.Delete("MyTextFiles/test.dat");

    //Delete the directory, even when it is not empty.
    ftp1.DeleteDirectory("MyTextFiles");
}
Private Sub deleteFiles()
    'Delete a list of files (in this case, the txt files).
    ftp1.Delete(ftp1.ListDirectoryTree("MyTextFiles", "*.txt", False))

    'Delete a specific file.
    ftp1.Delete("MyTextFiles/test.dat")

    'Delete the directory, even when it is not empty.
    ftp1.DeleteDirectory("MyTextFiles")
End Sub
See Also

Reference

Ftp Class
Ftp Members
Overload List


PowerTCP FTP for .NET Documentation Version 6.1
© 2023 Dart Communications. All Rights Reserved.
Send comments on this topic